<?php
include_once 'Element.php';

/**
 * @version 2 
 */
class TextArea extends Element {

    
    private $cols;
    private $rows;
    private $disabled;
    private $maxLength;
    private $autofocus;
    private $name;
    

    public function __construct($id, $value = '') {
        parent::__construct($id);
        $this->value = $value;
    }

    public function generate() {
        $html = array();
        $name = parent::getId();
        $cols = 'cols = "' . $this->cols . '"';
        $rows = 'rows = "' . $this->rows . '"';
        
        if ($this->disabled)
            $visibility = "disabled='true'";
        else
            $visibility = '';

        if ($this->maxLength)
            $max = 'maxlength="' . $this->maxLength . '"';
        else
            $max = '';

        if ($this->autofocus)
            $autofocus = 'autofocus="' . $this->maxLength . '"';
        else
            $autofocus = '';

       

        $html[] = "<textarea $cols $max $visibility  id='$name' name='$name' $rows >";

        $output = '';
        foreach ($html as $code) {
            $output = $output . $code;
        }
        return (String) $output . '</textarea>';
    }

    public function getCols() {
        return $this->cols;
    }

    public function setCols($cols) {
        $this->cols = $cols;
    }

    public function getRows() {
        return $this->rows;
    }

    public function setRows($rows) {
        $this->rows = $rows;
    }

    public function getVisibility() {
        return $this->visibility;
    }

    public function setVisibility($visibility) {
        $this->visibility = $visibility;
    }

    public function getDisabled() {
        return $this->disabled;
    }

    public function setDisabled($disabled) {
        $this->disabled = $disabled;
    }

    public function getMaxLength() {
        return $this->maxLength;
    }

    public function setMaxLength($maxLength) {
        $this->maxLength = $maxLength;
    }

    public function getAutofocus() {
        return $this->autofocus;
    }

    public function setAutofocus($autofocus) {
        $this->autofocus = $autofocus;
    }

    public function getName() {
        return $this->name;
    }

    public function setName($name) {
        $this->name = $name;
    }




}

?>
